package com.fanshuai.metrics.custom;

import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Slf4jReporter;

import java.util.concurrent.TimeUnit;

public class CustomMetrics {
    public static void init() {
        MetricRegistry metricRegistry = new MetricRegistry();

        ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry).build();
        //reporter.start(10, TimeUnit.SECONDS);

        Slf4jReporter reporter1 = Slf4jReporter.forRegistry(metricRegistry).build();
        reporter1.start(5, TimeUnit.SECONDS);

        metricRegistry.timer("aa").update(10, TimeUnit.MILLISECONDS);
    }
}
